home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 45 / Amiga Format CD45 (1999-09)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-11].iso / -serious- / misc / mcread / original / text.c < prev    next >
C/C++ Source or Header  |  1999-08-09  |  949b  |  42 lines

  1. /*    mcread: text.c
  2.     Copyright (C) 1991, Mike Gleason Jr & NCEMRSoft.
  3.     All Rights Reserved. */
  4.  
  5. #include <stdio.h>
  6. #include "mcread.h"
  7.  
  8. /*ARGSUSED*/
  9. int thrash_text(in, name, dataforklen, isTeachText)
  10.     register FILE *in;
  11.     char *name;
  12.     long dataforklen;
  13.     register short isTeachText;
  14. {
  15.     int c;
  16.     register long bytesIn;
  17.     
  18.     bytesIn = 0L;
  19.     wwInit(); c = 0;
  20.     while (bytesIn < dataforklen && c != EOF) {
  21.         wwInit();
  22.         while (bytesIn < dataforklen && (c = getc(in)) != EOF) {
  23.             bytesIn++;
  24.             if (isTeachText && c == HARDSPACE) {     /* TeachText inserts PICTs starting at id=1000,*/
  25.                 (void) puts("### picture omitted!");/* when it encounters a hard space. */
  26.                 while ((c = getc(in)) == '\r') bytesIn++;    /* Now, eat a bunch of blank lines. */
  27.                 (void) ungetc (c, in); bytesIn--;
  28.             }
  29.             else {
  30.                 if (wwPutchar(c & 0x00ff))
  31.                     return (0);
  32.                 if (c == '\r') break;
  33.             }
  34.         }
  35.         if (wwFlush())
  36.             return (0);
  37.     }
  38.     return (0);
  39. }    /* thrash_text */
  40.  
  41. /* eof */
  42.